<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <#--<meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">-->
    <title>支付</title>
</head>
<body>
<#--下载jquery的网站 bootcdn.cn/jquery-->
        <script src="https://cdn.bootcss.com/jquery/1.5.1/jquery.min.js"></script>
        <script src="https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>

    <div id="qrcode"></div>
    <div id="orderId">${orderId}</div>
    <div id="returnUrl">${returnUrl}</div>
        <script>/*这里是形成页面上的二维码*/
            jQuery('#qrcode').qrcode({
                 text: "http://www.baidu.com"
                <#--text:"${codeUrl}"  /*这里使用的是freemarker语法*/-->
            });
            //http://localhost:8080/pay/create?orderId=1234567891234&amount=0.01&payType=WXPAY_NATIVE
            $(function () {
                //定时器
                setInterval(function () {
                    console.log("开始查询支付状态...");
                    $ajax({
                        url:'/pay/queryByOrderId',
                        data:{'orderId':$('#orderId').text(),
                        success:function (result) {
                            console.log(result)
                            if(result.platformStatus != null && result.platformStatus ==='SUCCESS'){
                                location.href = $('#returnUrl')
                            }}
                        },
                        error:function (result) {
                            alter(result)
                        }
                    })
                })
            })
        </script>

</body>
</html>

